home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / Digsby build 37 / digsby_setup.exe / lib / digsbysite.pyo (.txt) < prev    next >
Python Compiled Bytecode  |  2008-10-13  |  7KB  |  272 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyo (Python 2.5)
  3.  
  4. import sys
  5. import os
  6. USE_PEAK = False
  7. if USE_PEAK:
  8.     import peak
  9.     peak.install()
  10.  
  11.  
  12. try:
  13.     import svnrev
  14.     svnrev.REVISION
  15. except Exception:
  16.     sys.REVISION = 'dev'
  17.  
  18. sys.REVISION = svnrev.REVISION
  19.  
  20. try:
  21.     import devmode
  22. except Exception:
  23.     sys.DEV = False
  24.  
  25. sys.DEV = devmode.awesome
  26. sepjoin = os.pathsep.join
  27. pathjoin = os.path.join
  28. lib_dir = pathjoin(os.path.dirname(sys.executable), 'lib')
  29. os.environ['PATH'] = sepjoin([
  30.     os.environ['PATH'],
  31.     lib_dir])
  32. if USE_PEAK:
  33.     
  34.     def __monkeypatch_wx__CallAfter(mod):
  35.         print 'lololmonkeypatch'
  36.         import wx as wx
  37.         wx.CallAfter = mod.CallAfterCombining
  38.  
  39.     __monkeypatch_wx__CallAfter = peak.whenImported('events')(__monkeypatch_wx__CallAfter)
  40.  
  41. import __builtin__
  42.  
  43. class Sentinel:
  44.     
  45.     def __init__(self, *a, **k):
  46.         pass
  47.  
  48.     
  49.     def __repr__(self):
  50.         return '<Sentinel %s>' % id(self)
  51.  
  52.     
  53.     def __nonzero__(self):
  54.         return False
  55.  
  56.  
  57. __builtin__.Sentinel = Sentinel
  58. __builtin__.sentinel = Sentinel()
  59. sys.modules['psyco'] = None
  60. restricted_names = frozenset([
  61.     'password',
  62.     'secret',
  63.     'pass',
  64.     'passwd'])
  65. OMITTED = '<OMITTED>'
  66. VALUE_LENGTH_LIMIT = 360
  67.  
  68. def formatexception(excinfo = None, lastframes = 8):
  69.     import StringIO as StringIO
  70.     import traceback as traceback
  71.     if excinfo is None:
  72.         excinfo = sys.exc_info()
  73.     
  74.     s = StringIO.StringIO()
  75.     tb = excinfo[2]
  76.     stack = []
  77.     if tb is not None:
  78.         while True:
  79.             if not tb.tb_next:
  80.                 break
  81.             
  82.             tb = tb.tb_next
  83.         f = tb.tb_frame
  84.         while f:
  85.             stack.append(f)
  86.             f = f.f_back
  87.     
  88.     stack.reverse()
  89.     if len(stack) > lastframes:
  90.         stack = stack[-lastframes:]
  91.     
  92.     print >>s, '\nVariables by last %d frames, innermost last' % (lastframes,)
  93.     restricted_values = []
  94.     for frame in stack:
  95.         print >>s, ''
  96.         print >>s, '  File "%s", line %d, in %s' % (frame.f_code.co_filename, frame.f_lineno, frame.f_code.co_name)
  97.         for key, value in frame.f_locals.items():
  98.             if type(value) == type(sys):
  99.                 continue
  100.             
  101.             if key == '__builtins__':
  102.                 continue
  103.             
  104.             for badthing in restricted_names:
  105.                 if badthing in key and value:
  106.                     restricted_values.append(value)
  107.                     value = OMITTED
  108.                     continue
  109.             
  110.             print >>s, '%15s = ' % (key,),
  111.             
  112.             try:
  113.                 if isinstance(value, type({ })) and value:
  114.                     valstring = []
  115.                     for _kk, _vv in sorted(value.items()):
  116.                         if _kk == '__builtins__':
  117.                             continue
  118.                         
  119.                         if (any,)((lambda .0: for x in .0:
  120. x in _kk)(restricted_names)) and _vv:
  121.                             valstring.append('%s=%r' % (_kk, OMITTED))
  122.                             restricted_values.append(_vv)
  123.                             continue
  124.                         valstring.append('%s=%r' % (_kk, _vv))
  125.                     
  126.                     valstring = ' '.join(valstring)[:VALUE_LENGTH_LIMIT]
  127.                     print >>s, valstring,
  128.                 else:
  129.                     print >>s, repr(value)[:VALUE_LENGTH_LIMIT]
  130.             continue
  131.             print >>s, '(Exception occurred printing value)'
  132.             continue
  133.  
  134.         
  135.     
  136.     traceback.print_exception(*excinfo, **{
  137.         'file': s })
  138.     retval = s.getvalue()
  139.     if isinstance(retval, unicode):
  140.         retval_str = retval.encode('utf-8', 'replace')
  141.     else:
  142.         retval_str = retval
  143.     for value in restricted_values:
  144.         if not value or value == OMITTED:
  145.             continue
  146.         
  147.         
  148.         try:
  149.             value_type = type(value)
  150.             if issubclass(value_type, basestring):
  151.                 if issubclass(value_type, unicode):
  152.                     value_str = value.encode('utf-8', 'replace')
  153.                 elif issubclass(value_type, str):
  154.                     value_str = value
  155.                 
  156.                 retval_str = retval_str.replace(value_str, OMITTED)
  157.             
  158.             retval_str = retval_str.replace(repr(value)[:VALUE_LENGTH_LIMIT], OMITTED)
  159.         continue
  160.         except UnicodeError:
  161.             continue
  162.             continue
  163.         
  164.  
  165.     
  166.     return retval
  167.  
  168. import traceback
  169. traceback._old_print_exc = traceback.print_exc
  170. traceback._old_format_exc = traceback.format_exc
  171.  
  172. def print_exc(limit = None, file = None):
  173.     
  174.     try:
  175.         if file is None:
  176.             file = sys.stderr
  177.         
  178.         formattedexc = formatexception()
  179.         file.write(formattedexc)
  180.     except:
  181.         traceback._old_print_exc()
  182.  
  183.  
  184. traceback.print_exc = print_exc
  185.  
  186. def format_exc():
  187.     
  188.     try:
  189.         return formatexception()
  190.     except:
  191.         return traceback._old_format_exc()
  192.  
  193.  
  194. traceback.format_exc = formatexception
  195.  
  196. def eh(*args):
  197.     
  198.     try:
  199.         print >>sys.stderr, formatexception(args)
  200.     except:
  201.         print >>sys.stderr, args
  202.  
  203.  
  204. if True:
  205.     sys.excepthook = eh
  206.  
  207. del traceback
  208.  
  209. class NullType(object):
  210.     
  211.     def __new__(cls, *args, **kwargs):
  212.         if '_inst' not in vars(cls):
  213.             cls._inst = object.__new__(cls, *args, **kwargs)
  214.         
  215.         return cls._inst
  216.  
  217.     
  218.     def __init__(self, *args, **kwargs):
  219.         pass
  220.  
  221.     
  222.     def __call__(self, *args, **kwargs):
  223.         return self
  224.  
  225.     
  226.     def __repr__(self):
  227.         return '<Null>'
  228.  
  229.     
  230.     def __nonzero__(self):
  231.         return False
  232.  
  233.     
  234.     def __getattr__(self, name):
  235.         return self
  236.  
  237.     
  238.     def __setattr__(self, name, value):
  239.         return self
  240.  
  241.     
  242.     def __delattr__(self, name):
  243.         return self
  244.  
  245.  
  246. __builtin__.Null = NullType()
  247. del NullType
  248. find_library = None
  249. if os.name == 'nt':
  250.     
  251.     def find_library(name):
  252.         for directory in sys.path + os.environ['PATH'].split(os.pathsep):
  253.             fname = os.path.join(directory, name)
  254.             if os.path.exists(fname):
  255.                 return fname
  256.             
  257.             if fname.lower().endswith('.dll'):
  258.                 continue
  259.             
  260.             fname = fname + '.dll'
  261.             if os.path.exists(fname):
  262.                 return fname
  263.                 continue
  264.         
  265.  
  266.  
  267. if find_library is not None:
  268.     import ctypes.util as ctypes
  269.     ctypes.util.find_library = find_library
  270.  
  271. del find_library
  272.